<?php

declare(strict_types=1);

namespace Modules\Promanagement\Models;

use Catch\Base\CatchModel as Model;

/**
 * @property $id
 * @property $workingcode
 * @property $processdata_id
 * @property $process
 * @property $unitprice
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
*/
class Provflowsional extends Model
{

    protected $table = 'provflowsional';
    protected $fillable = [ 'id', 'processflow_id', 'processdata_id', 'process', 'unitprice', 'creator_id', 'created_at', 'updated_at', 'deleted_at' , 'processtype' ];

    /**
     * @var array
     */
    protected array $fields = ['id','processflow_id','processdata_id','process','unitprice', 'creator_id','created_at','updated_at', 'deleted_at'];

    /**
     * @var array
     */
    protected array $form = ['id','processflow_id','processdata_id','process','unitprice', 'creator_id','created_at','updated_at', 'deleted_at'];


    /**
     * @var array
     */
    public array $searchable = [
        'processflow_id' => 'like',
        'processdata_id' => 'like',
        'process' => 'like',
    ];


    //输出相应的时间格式
    protected function serializeDate($date)
    {
        return $date->format('Y-m-d H:i');
    }

    /**
     * 关联工艺资料
     * @return mixed
     */
    public function processdata(){
        return $this->hasOne(Processdata::class,'id','processdata_id');
    }


}
